<?php
class ModelReportSearchKeyword extends Model {
	public function getKeywords($filter) {
		$sql = "SELECT * FROM @@keyword";
		$sql .= $filter->sort('keyword_id', 'DESC');
		$sql .= $filter->limit();
		$query = $this->db->query($sql);
		return $query->rows;
	}
	
	public function getTotalKeywords($filter = null) {
		return $this->db->queryOne("SELECT COUNT(*) FROM @@keyword");
	}
	
	public function deleteKeyword($keyword_id) {
		if (is_array($keyword_id)) $keyword_id = implode(',', $keyword_id);
		return $this->db->query("DELETE FROM @@keyword WHERE keyword_id IN ($keyword_id)");
	}
}